{
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "python385jvsc74a57bd041e327cf5d55014bea4c6468ccd778c90511ad3f7c2e1bbfcfa0ca936ae24ec1",
   "display_name": "Python 3.8.5 64-bit ('base': conda)"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2,
 "cells": [
  {
   "source": [
    "# 机构仿真\n",
    "\n",
    "## 继承层次结构\n",
    "\n",
    "* 机构mechanism\n",
    "    * 杆rob\n",
    "    * 杆组RRR,RRP\n",
    "* 点point\n",
    "* 绘图ui"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "## 机构:Mechanism\n",
    "\n",
    "### 方法：\n",
    "\n",
    "* get_robs(self)->list:用于获得杆件，以绘图\n",
    "\n",
    "* update(self,t_s):根据时间更新位置、运动参数"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "## 杆：Rob(Mechanism)\n",
    "\n",
    "### 初始量：\n",
    "\n",
    "* 形状参数：杆长$l$\n",
    "\n",
    "* 位置参数：基点$(x_{0},y_{0})$、倾角$\\phi_{0}$\n",
    "\n",
    "* 运动参数：\n",
    "    * 角速度$w_{0}$，角加速度$wa_{0}$\n",
    "    * 端点速度$v_{0}$，加速度$a_{0}$\n",
    "\n",
    "### 工作原理\n",
    "\n",
    "解算终点坐标表达式，后续更新位置等调用point.update(time)即可\n",
    "\n",
    "### Attrs:\n",
    "\n",
    "* index: 杆件唯一编号，自动分配\n",
    "* length: 杆长\n",
    "* basePoint,endPoint:基点与终点\n",
    "\n",
    "* phi,w,wa:角度、角速度、角加速度\n",
    "\n",
    "### Methods:\n",
    "* 构造器：__init__(self,length,basePoint:Point,symbol_phi,endPoint = None):\n",
    "    * p1:外接副1\n",
    "    * p2:外接副2\n",
    "    * l1,l2:杆长\n",
    "    * clockwise:bcd顺时针排列\n",
    "* 继承自Mechanism"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "## 基本杆组RRR(Mechanism)\n",
    "\n",
    "### Attrs\n",
    "* p0：内副C点\n",
    "* p1:外接副1，B点\n",
    "* p2：外接副2：D点\n",
    "* rob1：BC杆\n",
    "* rob2：CD杆\n",
    "* phi1：以B基点，CB倾角\n",
    "* phi2：D为基点，CD倾角\n",
    "*clockwise：BCD是否顺时针\n",
    "\n",
    "### Methods:\n",
    "* 构造器：__init__(self,p1:Point,p2:Point,l1,l2,clockwise = True):\n",
    "\n",
    "    * p1:外接副1\n",
    "    * p2:外接副2\n",
    "    * l1,l2:杆长\n",
    "    * clockwise:bcd顺时针排列\n",
    "* 继承自Mechanism"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "## 基本杆组RRP(Mechanism)\n",
    "\n",
    "### Attrs:\n",
    "   * p0：内副C点\n",
    "   * p1:外接副1，B点\n",
    "   * p2：外接副2：D点\n",
    "   * pk:参考点K，默认为导路基点\n",
    "   * rob1：BC杆\n",
    "   * rob2：CD杆\n",
    "   * road：KD导轨\n",
    "   * phi1：以B基点，CB倾角\n",
    "   * phi2：C为基点，CD倾角\n",
    "   * phiroad：导路KD倾角\n",
    "   * s:D点至基点距离\n",
    "\n",
    "### Methods:\n",
    "* 构造器：__init__(self,p1:Point,road:Rob,l1,l2,pk = None):\n",
    "\n",
    "   * p1:外接副1\n",
    "   * road:导路\n",
    "   * l1,l2:杆长\n",
    "   * pk:可选，导路上的参考点，默认为导路的基点\n",
    "\n",
    "* 继承自Mechanism\n",
    "\n"
   ],
   "cell_type": "markdown",
   "metadata": {}
  },
  {
   "source": [
    "## 绘图方式\n",
    "\n",
    "1. 构造构件m（可以有多个构件）\n",
    "2. 调用ui.add_mechanism(m)\n",
    "3. 调用ui.start_draw(starttime,holdtime,interval_ms):开始时刻、持续时间、绘图间隔，单位均为毫秒"
   ],
   "cell_type": "markdown",
   "metadata": {}
  }
 ]
}